class Cat:
    age = ''

    def __init__(self, name='', age=0):
        self.name = name
        self.age = age
        # print('self',id(self))

    def grow(self, year):
        self.age += year

    def __get__(self, instance, owner):
        print(instance)

    def __repr__(self):
        return f'name:{self.name}, age:{self.age}'


'''需求
 1.士兵 许三多 有一把 AK47
 2.士兵 可以 开火
 3.枪 能够 发射 子弹
 4.枪 装填 装填子弹 —— 增加子弹数量
'''
my_cat = Cat()
my_cat.name = 'my cat'
my_cat.grow(1)
my_cat.grow(1)
print(my_cat.name, my_cat.age)
# print('mycat:',id(my_cat))
new_cat = Cat('new cat', 5)
three_cat = Cat('three cat', 1)
l = [my_cat, new_cat, three_cat]
l.sort(key=lambda x: x.age)
print(l)

a = 1
print('a', id(a))
l = [1, 2, 3]
l2 = l
l2.append(4)
print(l, l2)
print('l:', id(l))
print('l2:', id(l2))
l3 = l.copy()
l3.append(5)
print(l, l2, l3)
print('l3:', id(l3))
